<%@page import="java.io.PrintWriter"%>
<%@page import="java.sql.ResultSet" import="java.sql.Statement" import="java.sql.Connection" import="connection.DBConnection"%>
<%@page import="java.util.*" %>
<%@page import="java.text.SimpleDateFormat" %>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Registration</title>

<script type="text/javascript" src="JS/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#sbutton').click(function(e) {
	        e.preventDefault();
	       			var a0 = $("#pan").val();
	    			var a1 = $("#org").val();
	    		    var a2 = $("#mvat").val();
	    		    var a3 = $("#add").val();
	    		    var a4 = $("#city").val();
	    		    var a5 = $("#dist").val();
	    		    var a6 = $("#state").val();
	    		    var a7 = $("#pin").val();
	    		    var a8 = $("#person").val();
	    		    var a9=$("#des").val();
	    		    
	    		    var value ='pann='+a0+'&or='+a1+'&mv='+a2+'&ad='+a3+'&ct='+a4+'&ds='+a5+'&st='+a6+'&pn='+a7+'&pr='+a8+'&desg='+a9;


	var c1,c2,c3,c4,c41,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15;
	
  	var namevalid=/^[a-zA-Z ]+$/;
  
  	c1= document.f1.org.value;
    c2= document.f1.mvat.value;
    c3= document.f1.add.value;
    c10= document.f1.city.value;
    c11= document.f1.dist.value;
    c7= document.f1.state.value;
    c12= document.f1.pin.value;
    c13= document.f1.person.value;
    c14= document.f1.des.value;
    if(c1=="" && c2=="" && c3=="" && c10=="" && c11=="" && c7=="" && c12=="" && c13=="" && c14=="")
    {
   	  
   	  alert("Please Enter values");
   	  document.f1.org_name.focus();
   	return false;
    }     
          /*  var regExp1 = /^(\d{1,2})\/(\d{1,2})\/(\d{2})$/;
            var regExp2 = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
            var result1 = document.f1.dob.value.match(regExp1);
            var result2 = document.f1.dob.value.match(regExp2);
            
            if (result1 == null && result2 == null)
            {
                alert("Enter a valid date.");
                document.f1.dob.value = "";
                document.f1.dob.focus();
                return false;
            }*/
     
    
    
     	  if(c12.length>6)
      	 {
          	alert("Pincode should be 6 digit");
          	document.f1.pin.value="";
            document.f1.pin.focus();
        		return false;
      	 }
          
          
     	 $.ajax({
     		 type:"post",  //post method
     		 url: "RegisterServlet2", //ajaxformexample url
     		 data: value, //
     	cache: false,
     	success: function(data) {
     	// $("#country").val('');
     	 $("#message").html(data).slideDown('slow');

     	 //$('.success1').fadeIn(200).show();
     		  // $('.error').fadeOut(200).hide();  		    }
     		
     	}
     	});
     		
     	return false;
     	});
     	}); 
    </script>

</head>
<body>
<h2 align="center"> Register with Books of Accounts</h2>
<form name="f1" action="RegisterServlet2" method=post >
<%	
				DBConnection dbc=new DBConnection();	
				Connection con=dbc.getNewConnection();
		
			 	Statement st = null;
			 	ResultSet rs = null;
			 	String pn="";
				
			
			 pn=(String)request.getAttribute("pn1");
       				%>
       				
       				<input type="hidden" name="pan" id="pan" value="<%=pn%>"/>
       				
<table cellspacing=6 align="center">
<tr>
<td>Name of the Organisation</td>
<td><input type="text" name="org" id="org" /></td>
</tr>
<tr>
<td>MVAT Number</td>
<td><input type="text" name="mvat" id="mvat"/></td><td><span class="error" style="display:none "><font color=red> Please Enter MVAT in digits</font></span></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="add" id="add"/></td>
</tr>

<tr>
<td>City</td>
<td><input type="text" name="city" id="city"/></td>
</tr>
<tr>
<td>District</td>
<td><input type="text" name="dist" id="dist"/></td>
</tr>
<tr>
<td>State</td>
<td><input type="text" name="state" id="state" /></td>
</tr>

<tr>
<td>Pin Code</td>
<td><input type="text" name="pin" id="pin"/></td>
</tr>
<tr>
<td>Name of the Authorised Person</td>
<td><input type="text" name="person" id="person"/></td>
</tr>
<tr>
<td>Designation</td>
<td><select name=des id=des>
<option></option>
<option>Proprietor</option>
<option>Partner</option>
<option>Director</option>
<option>Authorised Signatory</option>
</select></td>
</tr>
<tr><td></td>
<td><input type="Button" name="sbutton" id="sbutton" value="Submit"/></td>
<td></td>
</tr>
</table>
</form>
<form action="RegisterServlet3"><table align="center"><tr><td></td><td><input type="submit" name="skip" value="Skip"/></td>
<td><input type="submit" name="log" value="Go to Login page"/></td></tr></table></form>
<font face="verdana" size="2"><div id="message"></div></font>
</body>
</html>